package com.catcher.infobackup.xyf;


import android.net.Uri;
import android.provider.DocumentsContract;

public class StorageUtil {
    static String uDisk;
    static String tfCard;

    static boolean isUDiskMounted;
    static boolean isTFCardMounted;

    static String fsUuid;
    static String tfFsUuid;

    public final static void clearStates() {
        isUDiskMounted = false;
        isTFCardMounted = false;
    }

    public static boolean hasCardMounted() {
        return isUDiskMounted | isTFCardMounted;
    }

    public static void setUDiskPath(String path) {
        uDisk = path;
    }

    public static String getUdiskPath() {
        return uDisk;
    }

    public static boolean isUDiskMounted() {
        return isUDiskMounted;
    }

    public static void setUDiskState(boolean mounted) {
        isUDiskMounted = mounted;
    }

    public static void setTFCardPath(String path) {
        tfCard = path;
    }

    public static String getTFCardPath() {
        return tfCard;
    }

    public static boolean isTFCardMounted() {
        return isTFCardMounted;
    }

    public static void setTFCardState(boolean mounted) {
        isTFCardMounted = mounted;
    }

    public static void setUDiskFsUuid(String fsUuid) {
        StorageUtil.fsUuid = fsUuid;
    }

    public static String getUDiskFsUuid() {
        return fsUuid;
    }

    public static void setTfFsUuid(String tfFsUuid) {
        StorageUtil.tfFsUuid = tfFsUuid;
    }

    public static String getTfFsUuid() {
        return tfFsUuid;
    }

    public static Uri getPrimaryUri() {
        return DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY,
                DOCUMENT_ROOT_PRIMARY_EMULATED);
    }

    public static Uri getDiskUri(String fsUuid) {
        return DocumentsContract.buildRootUri(DOCUMENT_AUTHORITY, fsUuid);
    }

    public static String getAuthority() {
        return DOCUMENT_AUTHORITY;
    }

    public static String getPrimaryTag() {
        return DOCUMENT_ROOT_PRIMARY_EMULATED;
    }


    private static final String DOCUMENT_AUTHORITY = "com.android.externalstorage.documents";
    private static final String DOCUMENT_ROOT_PRIMARY_EMULATED = "primary";
}
